package com.huangliusong.hlsinspringboot.bootstrap;

import com.huangliusong.hlsinspringboot.condition.ConditonalOnSystemProperty;
import com.huangliusong.hlsinspringboot.repository.MyFirstLevelRepository;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;


public class ConditonSystemPropertyConditionBootStrap {

    /**
     * 这个bean就根据条件来装配
     * @return
     */
    @Bean
    @ConditonalOnSystemProperty(name = "user.name",value = "kw-hlss")
    public String helloWorld(){
        System.err.println("黄柳淞已经装配了");
        return "黄柳淞已经装配了";
    }
    public static void main(String[] args){
        ConfigurableApplicationContext context=new SpringApplicationBuilder(ConditonSystemPropertyConditionBootStrap.class)
                .web(WebApplicationType.NONE )
                .run(args );


        context.close();
    }
}
